<template>
  <div>
    <BaseInfo :baseInfo="baseInfo"></BaseInfo>
    <h6>录入明细</h6>
    <Disburse class="mt20" :disburseList="disburseList"></Disburse>
    <Repay class="mt20" :repayList="repayList"></Repay>
  </div>
</template>

<script>
import BaseInfo from '@/views/enterpriseModel/repaymentEntry/components/BaseInfo.vue'
import Disburse from '@/views/enterpriseModel/repaymentEntry/components/Disburse.vue'
import Repay from '@/views/enterpriseModel/repaymentEntry/components/Repay.vue'
import { PAYMENT_ENTRY_STATUS } from '@/constants/enterpriseModel.js'

export default {
  name: 'repaymentEntryDetail',
  components: {
    BaseInfo,
    Disburse,
    Repay,
  },
  data() {
    return {
      baseInfo: {},
      repayList: [],
      disburseList: [],
    }
  },
  methods: {
    async getDetailRequest() {
      const res = await this.$http.get(`/repayment/records/${this.$route.query.recordId}`)
      this.baseInfo = {
        tenantName: res.tenantName,
        drawdownNum: res.drawdownNum,
        repayNum: res.repayNum,
        notRepayAmount: res.notRepayAmount,
        appName: res.appName,
        drawdownAmount: res.drawdownAmount,
        repayAmount: res.repayAmount,
        status: PAYMENT_ENTRY_STATUS[res.status],
        productName: res.productName,
        createDate: res.createDate,
      }
      this.disburseList = res.drawdownDetail
      this.repayList = res.repayDetail
    },
  },
  mounted() {
    this.getDetailRequest()
  },
}
</script>

<style lang="scss" scoped></style>
